package com.yjhb.android.sbz.activity;

import android.content.Intent;
import android.view.MotionEvent;
import android.view.View;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.adapter.TaskPublishStateAdapter;
import com.yjhb.android.sbz.entity.TaskPublishState;

import com.jojo.android.zxlib.base.mvp.BasePresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建者 zx
 * 创建时间 2020/11/20 11:42
 */
public class PublishManageActivity extends BaseActivity implements View.OnTouchListener {
    private final String TAG = "PublishActivity";
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;


    TaskPublishStateAdapter adapter;
    private List<TaskPublishState> states = new ArrayList<>();

    @Override
    protected boolean isImmerse() {
        return true;
    }

    @Override
    protected BasePresenter initPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_publish;
    }

    @Override
    protected void initUI() {
        initItems();
        recyclerView.setLayoutManager(new GridLayoutManager(this, 3));
        recyclerView.setAdapter(adapter = new TaskPublishStateAdapter(this));
        adapter.setData(states);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void regEvent() {

    }

    @OnClick(R.id.back)
    public void back() {
        finish();
    }

    @OnClick(R.id.publish_iv)
    public void publish_iv() {
        startActivity(new Intent(this, PublishTypeActivity.class));
    }

    private void initItems() {
        states.clear();

        TaskPublishState state = new TaskPublishState();
        state.setIcon(R.mipmap.to_be_reviewed);
        state.setState("待审核");
        state.setNum(0);
        state.setDepict("等待人工审核");
        state.setTargetClassPath("");
        states.add(state);


        state = new TaskPublishState();
        state.setIcon(R.mipmap.on_display);
        state.setState("展示中");
        state.setNum(0);
        state.setDepict("正在展示的悬赏");
        state.setTargetClassPath("");
        states.add(state);

        state = new TaskPublishState();
        state.setIcon(R.mipmap.suspend);
        state.setState("已暂停");
        state.setNum(0);
        state.setDepict("暂停对外展示");
        state.setTargetClassPath("");
        states.add(state);

        state = new TaskPublishState();
        state.setIcon(R.mipmap.fail);
        state.setState("审核失败");
        state.setNum(0);
        state.setDepict("悬赏被审核失败");
        state.setTargetClassPath("");
        states.add(state);

        state = new TaskPublishState();
        state.setIcon(R.mipmap.to_reveiew);
        state.setState("复审相关");
        state.setNum(0);
        state.setDepict("复审/举报");
        state.setTargetClassPath("");
        states.add(state);

        state = new TaskPublishState();
        state.setIcon(R.mipmap.other);
        state.setState("其他状态");
        state.setNum(0);
        state.setDepict("未付款、已结束等");
        state.setTargetClassPath("");
        states.add(state);


    }


    @Override
    public boolean onTouch(View v, MotionEvent event) {

        return false;
    }
}
